
import { action, observable } from 'mobx';
import { SearchLogDto } from '../services/searchLog/dto/searchLogDto';
import { MySearchLogQueryDto } from '../services/searchLog/dto/mySearchLogQueryDto';
import searchLogService from '../services/searchLog/searchLogService';

class SearchLogStore {
    @observable logs: SearchLogDto[]

    @action
    async getMySearchLogs(input: MySearchLogQueryDto) {
        await searchLogService.getMySearchLogs(input).then((res) => {
            this.logs = res.data.result
        })
    }

    @action
    async deleteSearchLog(id: number) {
        await searchLogService.deleteSearchLog(id)
    }

    @action
    async createLogs(obj: object) {
        await searchLogService.createLogs(obj)
    }

    @action
    async deleteAll(moduleTypeId: string) {
        await searchLogService.deleteAll(moduleTypeId)
    }

}

export default SearchLogStore